<?php
declare (strict_types = 1);

namespace app\validate\common\finance;

use think\Validate;
use app\model\communal\FinanceCoinModel;


class BalanceValidate extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'id' => ['require', 'number', 'gt:0'],
        'amount' => ['require', 'gt:0', 'elt:9999999999999'],
        // 订单状态 1 待审核 2 审核驳回 3 审核通过 4 提现成功
        'type' => ['require', 'in:2,3'],

        'page' => ['number', 'gt:0'],
        'page_size' => ['number', 'gt:0'],
    ];

    protected $field = [
        'id' => '提现订单',
        'amount' => '提现金额',
        'type' => '订单状态',

        'page' => '当前页数',
        'page_size' => '每页条数',
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [];

    /**
     * 场景
     * @var array
     */
    protected $scene = [
        'index' => ['page', 'page_size'],
        'cash' => ['amount'],
        'rr' => ['id', 'type'],
    ];

    /**
     * scene save
     *
     * @return $this
     */
    public function sceneSave()
    {
        return $this->only(FinanceCoinModel::$saveColumn);
    }
}
